#version 460
#extension GL_EXT_ray_tracing : require
#extension GL_EXT_scalar_block_layout : enable
#extension GL_EXT_nonuniform_qualifier : enable
#extension GL_GOOGLE_include_directive : enable
#extension GL_EXT_buffer_reference2 : require
#extension GL_EXT_shader_explicit_arithmetic_types_int64 : require
#extension GL_ARB_shader_clock : enable
#extension GL_EXT_shader_16bit_storage : enable


#include "../../../../core/shader_std.h"
#include "../../../../core/shader_built_in_functions.h"
#include "../../../../core/shader_PBR.h"
#include "../../../../core/shader_ob.h"




layout(binding = 0, set = 0) uniform accelerationStructureEXT topLAS;
//layout(binding = DEF_BINDING_Render_Camera, set = 0) uniform CameraProp {
//	mat4 projInverse;
//	mat4 viewInverse;
//	mat4 projMat;
//	mat4 viewMat;
//} cam;

layout(binding = DEF_RenderFrameBindID, set = 0, scalar) uniform FrameProp {
	GLSL_RenderFrame renderFrame;
};

layout(location = 0) rayPayloadInEXT S_Ray hitValue;
layout(location = 3) callableDataEXT S_SceneDataCall callSceneData;

//hitAttributeEXT vec2 attribs;



void main() {

	uint flags = gl_RayFlagsOpaqueEXT;
	uint cullMask = 0xff;
	float tmin = 0.0001;
	float tmax = 2000.0;
	vec3 origin = gl_WorldRayOriginEXT + gl_WorldRayDirectionEXT * gl_HitTEXT;

	if(false){
		//traceRayEXT(topLAS, flags, cullMask, 0, 0, 0, origin, tmin, gl_WorldRayDirectionEXT, tmax, 0);
	}
	
	hitValue.Color += vec3(1);
	++hitValue.Depth;
	return;
}




